/* eslint-disable */
// @ts-ignore
import { queryOptions, useMutation } from '@tanstack/vue-query';
import type { DefaultError } from '@tanstack/vue-query';
import { request } from '@/utils/http/request';
import type { AxiosRequestConfig } from 'axios';
import type { RequestOptions as RequestOptionsType } from '/#/axios';
type RequestOptions = RequestOptionsType & AxiosRequestConfig;

import * as apis from './loginService';
import * as API from './types';

/** 登录方法 POST /login https://apifox.com/web/project/3535734/apis/api-123324394-run */
export function useSubmitApiLoginMutation(options?: {
  onSuccess?: (value?: API.AjaxResult) => void;
  onError?: (error?: DefaultError) => void;
}) {
  const { onSuccess, onError } = options || {};

  const response = useMutation({
    mutationFn: apis.submitApiLogin,
    onSuccess(data: API.AjaxResult) {
      onSuccess?.(data);
    },
    onError(error) {
      onError?.(error);
    },
  });

  return response;
}
